#pragma once
#include <map>

using namespace std;
typedef pair <double, double> Point;


class Envelope
{
public:
    multimap<double, double> * points;

    Envelope();
    ~Envelope();

    unsigned int oldSize, size;

    double getValue(double tSamples);
    void setupSpline();
    void draw();

private:
    multimap<double, double> * pointsInterp;
    multimap<double, double> :: const_iterator it;

    double validFrom;
    double validTo;
    double coeff;
    double offset;

    float minGrad; //the minimum gradient of the spline below which points are removed
    void thin();
};


